import { Layout, Modal, Button } from 'antd'
import React, { useEffect, useState } from 'react'
import {removeCookie} from "../utils/auth"
import {NavLink,history} from "umi"
import './management.less'
import {observer} from 'mobx-react-lite'


// var thisPage=false;
// window.onbeforeunload=function checkLeave(e : any){
//  var evt = e ? e : (window.event ? window.event : null);        //此方法为了在firefox中的兼容
//     if(!thisPage)evt.returnValue='离开会使编写的内容丢失。';
// }

  const { Header, Content, Footer } = Layout

  const Management: React.FC = (props) => {
      //用户名字
  const username = localStorage.getItem('username')
    //实例化
   function outLogin(){
    removeCookie();
    localStorage.clear();
    history.replace("/")
   }
    // onClick={()=>window.hmt.push(['_trackEvent', 'teachers/job', 'click', '岗位', '岗位'])}
    return <div className="man"> 
              <div className="header">
                <h1>宏业找房后台管理系统</h1>
                 <div className="mz">
                     <h3>{username}</h3>
                     <p onClick={()=>outLogin()}>退出登录</p>
                 </div>
            </div>
            <div className="main">
                <div className="left">
                    <NavLink to="/management/houeslist">房产管理</NavLink>
                    <NavLink to="/management/userlist">用户管理</NavLink>
                </div>
                <div className="con">
                    {
                        props.children
                    }
                </div>
            </div>
        </div>
}
export default observer(Management)